﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace B2B.Models
{
    public class LoaiThanhVien
    {
        int maLoaiTV;

        public int MaLoaiTV
        {
            get { return maLoaiTV; }
            set { maLoaiTV = value; }
        }
        string tenLoaiTV;

        public string TenLoaiTV
        {
            get { return tenLoaiTV; }
            set { tenLoaiTV = value; }
        }

        public ArrayList DanhSachLoaiTV() 
        {
            ArrayList list = new ArrayList();
            SqlConnection conn = KetNoi.Connection();
            SqlCommand cmd = new SqlCommand("SP_DANHSACHLOAITHANHVIEN", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                LoaiThanhVien ltv = new LoaiThanhVien();
                ltv.MaLoaiTV = reader.GetInt32(0);
                ltv.TenLoaiTV = reader.GetString(1);
                list.Add(ltv);
            }
            conn.Close();
            return list;
        }
    }
}